package com.qianli.user.domain.facatory;

import com.fqgj.xjd.user.client.response.UserBehaviorRegister;
import com.fqgj.xjd.user.entity.UserBehaviorLoginEntity;
import com.fqgj.xjd.user.entity.UserBehaviorRegisterEntity;
import com.qianli.user.domain.model.UserBehaviorModel;
import com.qianli.user.domain.model.behavior.UserBehaviorAppInfo;
import com.qianli.user.domain.respository.UserBehaviorRespository;
import com.qianli.user.ro.app.AppInfoRO;
import com.qianli.user.ro.behavior.UserBehaviorLoginRO;
import com.qianli.user.ro.behavior.UserBehaviorRegisterRO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * name:用户行为
 * auth:ting.li@qianli-inc.com
 * date:2018/1/2 09:49
 * version: v1.0.0
 **/
@Service
public class UserBehaviorFactory {
    @Autowired
    private UserBehaviorRespository userBehaviorRespository;

    /**
     * 加载模型
     * @param userBehaviorModel
     */
    public void load(UserBehaviorModel userBehaviorModel){
        userBehaviorRespository.load(userBehaviorModel);
    }

    /**
     * 保存行为信息
     * @param userBehaviorModel
     */
    public void store(UserBehaviorModel userBehaviorModel) {
        userBehaviorRespository.store(userBehaviorModel);
    }

    /**
     * 是否是信息
     * @param newUm
     * @return
     */
    public Boolean isNew(UserBehaviorModel newUm) {

        if(userBehaviorRespository.isNew(newUm)){
            return true;
        }
        return false;
    }

    /**
     * 查询最新登录信息
     * @param userCode
     * @return
     */
    public UserBehaviorLoginRO queryUserLatestBehaviorLogin(String userCode) {
        return userBehaviorRespository.queryUserLatestBehaviorLogin(userCode);
    }

    /**
     * 查询注册信息
     * @param userCode
     * @return
     */
    public UserBehaviorRegisterRO getUserBehaviorRegister(String userCode) {
        return userBehaviorRespository.getUserBehaviorRegister(userCode);

    }
}
